<template>
	<div class="footer" :style="oStyle">
		<p>
			博客已运行<span >{{longTime}}</span><span class="timeJump">(●'◡'●)ﾉ♥</span>
		</p>
		<p>
			代码仓库 <a href="https://gitee.com/weihen_admin/myVueWeb" target="_blank">gitee</a>&nbsp;&nbsp;
			由 <a href="https://webify.cloudbase.net" target="_blank">CloudBase Webify</a> 提供网站托管服务
		</p>
		<p>
			© {{currentTime}} <a href="#">肥菇凉</a>&nbsp;&nbsp;
			主题由 <a href="http://mangoya.cn/" target="_blank">http://mangoya.cn</a> 提供&nbsp;&nbsp;
		</p>
		<p>
			<a href="https://beian.miit.gov.cn">陇ICP备2021000907号-2</a>
		</p>
	</div>
</template>

<script>
	export default {
		name: 'Footer',
		data() {
			return {
				longTime: '', // 运行时间
				currentTime: '', // 当前时间
				oStyle: {}
			}
		},
		created() {
			let that = this;
			that.runTime();
			that.NewTime();
		},
		mounted() {
			let winHeight = document.documentElement.clientHeight;
			let pageHeight = document.body.clientHeight;
			if( winHeight > pageHeight ){
				this.oStyle = {position:'fixed',bottom:'0',}
			}else{
				this.oStyle = {}
			}
		},
		methods: {
			runTime: function() { //运行倒计时
				let that = this;
				let oldTime = new Date('2021/09/01 00:00:00');
				setInterval(function() {
					let nowTime = new Date();
					let longTime = nowTime - oldTime;
					let days = parseInt(longTime / 1000 / 60 / 60 / 24, 10); //计算剩余的天数
					let hours = parseInt(longTime / 1000 / 60 / 60 % 24, 10); //计算剩余的小时
					let minutes = parseInt(longTime / 1000 / 60 % 60, 10); //计算剩余的分钟
					let seconds = parseInt(longTime / 1000 % 60, 10); //计算剩余的秒数
					that.longTime = days + "天" + hours + "小时" + minutes + "分" + seconds + "秒";
				}, 1000)
			},
			NewTime: function() {
				let that = this;
				let date = new Date();
				that.currentTime = date.getFullYear()
			}
		},
	}
</script>

<style>
	@import url("../assets/css/style.css");
</style>
